var should = chai.should();

describe("cal", function()
{
    it("1", function()
    {
        var sum = cal(2,0,0,0,"820",[[0,100,60,40,23]]);
        should.equal(sum, 0);
    });
    it("2", function()
    {
       var sum = cal(2,0,0,0,"820",[[0,100,60,40,23],[0,70,40,40,27]]);
        should.equal(sum, 123);
    });
    it("3", function()
    	    {
		    	var sum = cal(2,1,0,0,"820",[[0,80,60,30,19],[0,70,50,40,21],[1,0,0,0,23],[2,0,0,0,45],[3,0,0,0,23],[4,0,0,0,23]]);
		        should.equal(sum, 8413);
    	    });
    it("4", function()
    	    {
    	       var sum = cal(2,1,0,0,"820",[[0,40,50,40,27]]);
    	       should.equal(sum, 0);
    	    });
    it("5", function()
    	    {
    	       var sum = cal(0,0,0,0,"820",[[0,20,40,30,23]]);
    	        should.equal(sum, 0);
    	    });
    it("6", function()
    	    {
    	       var sum = cal(1,0,0,0,"820",[[0,100,60,40,32],[0,90,50,30,23],[0,80,40,20,21],[5,0,0,0,3]]);
    	        should.equal(sum, 1374);
    	    });
    it("7", function()
    	    {
    	       var sum = cal(0,0,0,0,"820",[[1,0,0,0,32]]);
    	        should.equal(sum, 2600);
    	    });
    it("8", function()
    	    {
    	       var sum = cal(1,0,3,0,"820",[[0,100,60,40,29]]);
    	        should.equal(sum, 0);
    	    });
    it("9", function()
    	    {
    	       var sum = cal(0,1,0,0,"820",[[0,100,60,40,29],[0,100,60,40,32],[0,100,60,40,28],[6,0,0,0,23]]);
    	        should.equal(sum, 5557);
    	    });
    it("10", function()
    	    {
    	       var sum = cal(1,2,1,0,"820",[[0,70,50,30,25],[0,80,45,30,29],[5,0,0,0,3]]);
    	        should.equal(sum, 1349);
    	    });
    it("11", function()
    	    {
    	       var sum = cal(0,2,3,0,"820",[[0,70,50,30,25],[0,80,45,30,29]]);
    	        should.equal(sum, 172);
    	    });
    it("12", function()
    	    {
    	       var sum = cal(1,2,3,0,"820",[[0,70,50,30,25]]);
    	        should.equal(sum, 0);
    	    });
    it("13", function()
    	    {
    	       var sum = cal(2,1,1,0,"820",[[0,70,50,30,33]]);
    	        should.equal(sum, -1);
    	    });
    it("14", function()
    	    {
    	       var sum = cal(2,1,2,0,"820",[[0,100,100,30,25],[0,80,45,30,29],[5,0,0,0,3]]);
    	        should.equal(sum, -1);
    	    });
    it("15", function()
    	    {
    	       var sum = cal(2,2,1,0,"820",[[0,70,50,30,1]]);
    	        should.equal(sum, -1);
    	    });
    it("16", function()
    	    {
    	       var sum = cal(2,2,1,0,"820",[[0,20,20,10,25]]);
    	        should.equal(sum, -1);
    	    });
    it("17", function()
    	    {
    	       var sum = cal(2,2,1,0,"820",[[1,70,50,30,46],[0,80,45,30,29],[5,0,0,0,3]]);
    	        should.equal(sum, -1);
    	    });
    
    it("18", function()
    	    {
    	       var sum = cal(2,2,1,0,"820",[[1,70,50,30,1],[0,80,45,30,29],[5,0,0,0,3]]);
    	        should.equal(sum, -1);
    	    });
    it("19", function()
    	    {
    	       var sum = cal(0,0,1,4,"820",[[2,70,50,30,46],[0,80,45,30,29],[5,0,0,0,3]]);
    	        should.equal(sum, -1);
    	    });
    it("20", function()
    	    {
    	       var sum = cal(0,0,3,5,"820",[[2,70,50,30,1],[0,80,45,30,29],[5,0,0,0,3]]);
    	        should.equal(sum, -1);
    	    });
    it("21", function()
    	    {
    	       var sum = cal(1,1,0,0,"820",[[3,70,50,30,33],[0,80,45,30,29],[5,0,0,0,3]]);
    	        should.equal(sum, -1);
    	    });
    it("22", function()
    	    {
    	       var sum = cal(0,2,0,0,"820",[[3,70,50,30,1],[0,80,45,30,29],[5,0,0,0,3]]);
    	        should.equal(sum, -1);
    	    });
    it("23", function()
    	    {
    	       var sum = cal(1,1,2,2,"820",[[4,70,50,30,33],[0,80,45,30,29],[5,0,0,0,3]]);
    	        should.equal(sum, -1);
    	    });
    it("24", function()
    	    {
    	       var sum = cal(2,2,1,0,"820",[[4,70,50,30,1],[0,80,45,30,29],[5,0,0,0,3]]);
    	        should.equal(sum, -1);
    	    });
    
    it("25", function()
    	    {
    	       var sum = cal(2,2,1,0,"820",[[5,70,50,30,6],[0,80,45,30,29],[5,0,0,0,3]]);
    	        should.equal(sum, -1);
    	    });
    it("26", function()
    	    {
    	       var sum = cal(2,2,1,0,"820",[[5,70,50,30,1],[0,80,45,30,29],[5,0,0,0,3]]);
    	        should.equal(sum, -1);
    	    });
    it("27", function()
    	    {
    	       var sum = cal(2,2,1,0,"820",[[6,70,50,30,33],[0,80,45,30,29],[5,0,0,0,3]]);
    	        should.equal(sum, -1);
    	    });
    it("28", function()
    	    {
    	       var sum = cal(2,2,1,0,"820",[[6,70,50,30,1],[0,80,45,30,29],[5,0,0,0,3]]);
    	        should.equal(sum, -1);
    	    });
    it("29", function()
    	    {
    	       var sum = cal(2,1,0,1,"1500",[[0,70,40,30,22],[0,70,40,30,22],[0,70,40,30,22]]);
    	        should.equal(sum, 1400);
    	    });
    it("30", function()
    	    {
    	       var sum = cal(2,1,0,1,"2000",[[0,80,50,30,23],[0,70,40,30,32],[0,70,30,20,23]]);
    	        should.equal(sum, 2380);
    	    });
    it("31", function()
    	    {
    	       var sum = cal(2,1,0,1,"2000",[[0,70,40,30,32],[0,40,40,30,27],[0,70,40,30,32],[0,70,40,30,27]]);
    	        should.equal(sum, 3400);
    	    });
    it("32", function()
    	    {
    	       var sum = cal(2,1,1,1,"2000",[[0,80,50,30,23],[0,70,40,30,32],[0,60,30,30,23],[0,80,50,30,32]]);
    	        should.equal(sum, 5360);
    	    });
    it("33", function()
    	    {
    	       var sum = cal(2,1,1,1,"2000",[[0,90,50,30,20],[0,80,40,20,30],[0,80,40,20,30],[0,80,40,20,30],[0,80,40,20,30]]);
    	        should.equal(sum, 7380);
    	    });
    it("34", function()
    	    {
    	       var sum = cal(2,1,1,1,"2000",[[0,70,50,30,27]]);
    	        should.equal(sum, 0);
    	    });
    it("35", function()
    	    {
    	       var sum = cal(2,1,1,1,"2000",[[0,80,50,30,20],[0,70,40,30,30],[0,70,40,30,30],[0,70,40,30,30],[0,100,40,20,30]]);
    	        should.equal(sum, 8360);
    	    });
    it("36", function()
    	    {
    	       var sum = cal(2,1,1,1,"2000",[[0,80,50,20,27]]);
    	        should.equal(sum, 0);
    	    });
    it("37", function()
    	    {
    	       var sum = cal(2,1,1,1,"2000",[[0,80,60,30,20],[0,70,40,30,30],[0,70,40,30,30],[0,70,40,30,30],[0,70,40,30,30],[0,70,40,30,30]]);
    	        should.equal(sum, 10380);
    	    });
    it("38", function()
    	    {
    	       var sum = cal(2,1,1,1,"2000",[[0,80,60,30,20],[0,70,40,30,32],[0,70,40,30,30],[0,70,40,30,30],[0,70,40,30,30],[0,70,50,40,30]]);
    	        should.equal(sum, 11360);
    	    });
    it("39", function()
    	    {
    	       var sum = cal(2,1,3,1,"2000",[[0,50,50,40,21]]);
    	        should.equal(sum, 0);
    	    });
    it("40", function()
    	    {
    	       var sum = cal(2,1,3,1,"2000",[[0,50,50,40,25],[0,50,50,40,21]]);
    	        should.equal(sum, 380);
    	    });
    it("41", function()
    	    {
    	       var sum = cal(2,1,3,1,"2000",[[0,50,50,40,29],[0,50,50,40,21]]);
    	        should.equal(sum, 980);
    	    });
    it("42", function()
    	    {
    	       var sum = cal(2,1,3,1,"2000",[[0,50,50,40,29],[0,100,30,40,21]]);
    	        should.equal(sum, 1960);
    	    });
    it("43", function()
    	    {
    	       var sum = cal(2,1,3,1,"2000",[[0,80,50,40,29],[0,50,50,20,21]]);
    	        should.equal(sum, 1400);
    	    });
    it("44", function()
    	    {
    	       var sum = cal(2,1,3,1,"2000",[[0,50,50,20,21]]);
    	        should.equal(sum, 0);
    	    });
    it("45", function()
    	    {
    	       var sum = cal(2,1,3,1,"2000",[[0,50,50,30,25],[0,50,50,40,21],[0,50,50,40,24]]);
    	        should.equal(sum, 2160);
    	    });
    it("46", function()
    	    {
    	       var sum = cal(2,1,3,1,"2000",[[0,50,50,30,29],[0,50,50,40,21],[0,50,40,40,23]]);
    	        should.equal(sum, 2380);
    	    });
    it("47", function()
    	    {
    	       var sum = cal(2,1,3,1,"2000",[[0,80,50,40,20],[0,50,50,40,21],[0,80,50,40,23]]);
    	        should.equal(sum, 3360);
    	    });
    it("48", function()
    	    {
    	       var sum = cal(1,1,3,1,"2000",[[0,80,50,40,28],[0,50,50,40,21],[0,80,50,40,24]]);
    	        should.equal(sum, 4200);
    	    });
    it("49", function()
    	    {
    	       var sum = cal(1,1,3,1,"2000",[[0,50,50,20,21]]);
    	        should.equal(sum, 0);
    	    });
    it("50", function()
    	    {
    	       var sum = cal(1,1,3,1,"2000",[[0,50,50,20,24],[0,50,50,30,22],[0,70,50,30,20],[0,70,50,30,20]]);
    	        should.equal(sum, 3780);
    	    });
    it("51", function()
    	    {
    	       var sum = cal(1,1,3,1,"2000",[[0,50,50,20,29],[0,50,50,30,22],[0,70,50,30,20],[0,70,50,30,20]]);
    	        should.equal(sum, 4380
    	        		
    	        );
    	    });
    it("52", function()
    	    {
    	       var sum = cal(1,1,3,1,"2000",[[0,90,60,20,21],[0,50,50,30,22],[0,70,50,30,20],[0,70,50,30,20]]);
    	        should.equal(sum, 4380);
    	    });
    it("53", function()
    	    {
    	       var sum = cal(1,1,3,1,"2000",[[0,90,60,20,29],[0,50,50,30,22],[0,70,50,30,20],[0,70,50,30,20]]);
    	        should.equal(sum, 4800);
    	    });
    it("54", function()
    	    {
    	       var sum = cal(1,1,3,1,"2000",[[0,60,40,20,20]]);
    	        should.equal(sum, 0);
    	    });
    it("55", function()
    	    {
    	       var sum = cal(1,1,3,1,"2000",[[0,60,40,20,24],[0,50,50,30,22],[0,70,50,30,20],[0,70,50,30,20],[0,70,20,10,30]]);
    	        should.equal(sum, 7760);
    	    });
    it("56", function()
    	    {
    	       var sum = cal(1,1,3,1,"2000",[[0,60,20,20,30],[0,50,50,30,22],[0,70,50,30,20],[0,70,50,30,20],[0,70,20,10,30]]);
    	        should.equal(sum, 8360);
    	    });
    it("57", function()
    	    {
    	       var sum = cal(1,1,3,1,"2000",[[0,100,60,20,20],[0,50,50,30,22],[0,70,50,30,20],[0,70,50,30,20],[0,70,20,10,20]]);
    	        should.equal(sum, 7380);
    	    });
    it("58", function()
    	    {
    	       var sum = cal(1,1,3,1,"2000",[[0,100,60,20,30],[0,50,50,30,22],[0,70,50,30,20],[0,70,50,30,20],[0,70,20,10,20]]);
    	        should.equal(sum, 7800);
    	    });
    it("59", function()
    	    {
    	       var sum = cal(1,1,3,1,"2000",[[0,40,40,20,10]]);
    	        should.equal(sum, 0);
    	    });
    it("60", function()
    	    {
    	       var sum = cal(1,1,3,1,"2000",[[0,60,40,20,24],[0,50,50,30,22],[0,70,50,30,20],[0,70,50,30,20],[0,70,20,10,30],[0,70,20,10,21]]);
    	        should.equal(sum, 10760);
    	    });
    it("61", function()
    	    {
    	       var sum = cal(1,1,3,1,"2000",[[0,60,40,20,30],[0,50,50,30,22],[0,70,50,30,20],[0,70,50,30,20],[0,50,30,20,30],[0,90,50,30,20]]);
    	        should.equal(sum, 12340);
    	    });
    it("62", function()
    	    {
    	       var sum = cal(1,1,3,1,"2000",[[0,100,50,30,20],[0,50,50,30,22],[0,70,50,30,20],[0,70,50,30,20],[0,50,30,20,20],[0,50,30,20,25]]);
    	        should.equal(sum, 10760);
    	    });
    it("63", function()
    	    {
    	       var sum = cal(1,1,3,1,"2000",[[0,100,50,30,30],[0,50,50,30,22],[0,70,50,30,20],[0,70,50,30,20],[0,50,30,20,20],[0,50,30,20,20]]);
    	        should.equal(sum, 10800);
    	    });
    //Q3
    it("64", function()
    	    {
    	       var sum = cal(1,1,1,3,"3000",[[0,60,40,20,29]]);
    	        should.equal(sum, 0);
    	    });
    it("65", function()
    	    {
    	       var sum = cal(1,1,1,3,"3000",[[0,100,40,40,31]]);
    	        should.equal(sum, 520);
    	    });
    it("66", function()
    	    {
    	       var sum = cal(1,1,1,3,"3000",[[0,60,40,20,29]]);
    	        should.equal(sum, 0);
    	    });
    it("67", function()
    	    {
    	       var sum = cal(1,1,1,3,"3000",[[0,100,60,20,27],[0,50,50,30,22],[0,70,50,20,21]]);
    	        should.equal(sum, 1690);
    	    });
    it("68", function()
    	    {
    	       var sum = cal(1,1,1,3,"3000",[[0,50,50,20,29]]);
    	        should.equal(sum, 0);
    	    });
    it("69", function()
    	    {
    	       var sum = cal(1,1,1,3,"3000",[[0,100,60,20,27],[0,50,50,30,22],[0,70,50,20,21],[0,70,50,20,21]]);
    	        should.equal(sum, 2860);
    	    });
    it("70", function()
    	    {
    	       var sum = cal(1,1,1,3,"3000",[[0,60,40,20,29]]);
    	        should.equal(sum, 0);
    	    });
    it("71", function()
    	    {
    	       var sum = cal(1,1,3,3,"3000",[[0,100,60,20,20],[0,50,50,30,22],[0,70,50,20,21],[0,70,50,20,21],[0,70,50,20,26]]);
    	        should.equal(sum, 6560);
    	    });
    it("72", function()
    	    {
    	       var sum = cal(1,1,3,3,"3000",[[0,40,40,40,22]]);
    	        should.equal(sum, 0);
    	    });
    it("73", function()
    	    {
    	       var sum = cal(1,1,3,3,"3000",[[0,100,60,20,27]]);
    	        should.equal(sum, 520);
    	    });
    it("74", function()
    	    {
    	       var sum = cal(1,1,3,3,"3000",[[0,100,60,20,27],[0,50,50,10,21]]);
    	        should.equal(sum, 1690);
    	    });
    it("75", function()
    	    {
    	       var sum = cal(1,1,3,3,"3000",[[0,50,50,30,22]]);
    	        should.equal(sum, 0);
    	    });
    it("76", function()
    	    {
    	       var sum = cal(1,1,3,3,"3000",[[0,100,60,20,20],[0,50,50,20,22],[0,50,50,20,22],[0,60,50,20,20]]);
    	        should.equal(sum, 4450);
    	    });
    it("77", function()
    	    {
    	       var sum = cal(1,1,3,3,"3000",[[0,50,50,30,22]]);
    	        should.equal(sum, 0);
    	    });
    it("78", function()
    	    {
    	       var sum = cal(1,1,3,3,"3000",[[0,100,60,20,20],[0,50,50,30,22],[0,70,30,20,22],[0,70,40,20,20],[0,70,40,20,26]]);
    	        should.equal(sum, 6560);
    	    });
    it("79", function()
    	    {
    	       var sum = cal(1,1,2,3,"3000",[[0,70,30,20,22]]);
    	        should.equal(sum, 0);
    	    });
    it("80", function()
    	    {
    	       var sum = cal(1,1,2,3,"3000",[[0,100,60,20,24]]);
    	        should.equal(sum, 520);
    	    });
    it("81", function()
    	    {
    	       var sum = cal(1,1,2,3,"3000",[[0,50,50,20,22]]);
    	        should.equal(sum, 0);
    	    });
    it("82", function()
    	    {
    	       var sum = cal(1,1,2,3,"3000",[[0,100,60,20,24],[0,50,50,20,22],[0,100,50,30,24]]);
    	        should.equal(sum, 2210);
    	    });
    it("83", function()
    	    {
    	       var sum = cal(1,1,2,3,"3000",[[0,50,50,20,22]]);
    	        should.equal(sum, 0);
    	    });
    it("84", function()
    	    {
    	       var sum = cal(1,1,2,3,"3000",[[0,100,60,20,24],[0,50,50,30,22],[0,100,50,30,24],[0,70,20,20,20]]);
    	        should.equal(sum,3380);
    	    });
    it("85", function()
    	    {
    	       var sum = cal(1,1,2,3,"3000",[[0,50,50,30,22]]);
    	        should.equal(sum, 0);
    	    });
    it("86", function()
    	    {
    	       var sum = cal(1,1,2,3,"3000",[[0,100,60,20,24],[0,50,50,30,22],[0,100,50,30,24],[0,70,20,20,20],[0,40,40,20,29]]);
    	        should.equal(sum, 5490);
    	    });
    it("87", function()
    	    {
    	       var sum = cal(1,1,2,3,"3000",[[0,50,50,30,22]]);
    	        should.equal(sum, 0);
    	    });
    it("88", function()
    	    {
    	       var sum = cal(1,1,2,3,"3000",[[0,100,60,20,24],[0,50,50,30,22],[0,100,50,30,24],[0,70,20,20,20],[0,40,40,20,29],[0,70,20,20,20]]);
    	        should.equal(sum, 7080);
    	    });
    //Q4
    it("89", function()
    	    {
    	       var sum = cal(2,1,0,4,"1500",[[0,50,50,30,32]]);
    	        should.equal(sum, 0);
    	    });
    it("90", function()
    	    {
    	       var sum = cal(2,1,0,4,"1500",[[0,100,40,20,32]]);
    	        should.equal(sum, 1040);
    	    });
    it("91", function()
    	    {
    	       var sum = cal(2,1,0,4,"1500",[[0,100,20,20,22],[0,100,20,20,22],[0,100,20,20,22]]);
    	        should.equal(sum, 1380);
    	    });
    it("92", function()
    	    {
    	       var sum = cal(2,1,0,4,"1500",[[0,100,40,20,23],[0,100,20,20,32],[0,80,20,20,23]]);
    	        should.equal(sum, 2420);
    	    });
    it("93", function()
    	    {
    	       var sum = cal(2,1,0,4,"2000",[[0,100,30,28,32],[0,100,20,10,27],[0,100,30,28,32],[0,80,20,20,27]]);
    	        should.equal(sum, 2760);
    	    });
    it("94", function()
    	    {
    	       var sum = cal(2,1,1,4,"2000",[[0,100,30,30,23],[0,100,20,20,32],[0,80,20,20,23],[0,100,30,30,32]]);
    	        should.equal(sum, 4840);
    	    });
    it("95", function()
    	    {
    	       var sum = cal(2,1,1,4,"2000",[[0,100,30,20,27]]);
    	        should.equal(sum, 0);
    	    });
    it("96", function()
    	    {
    	       var sum = cal(2,1,1,4,"2000",[[0,100,40,32,20],[0,100,20,20,30],[0,100,20,20,30],[0,100,20,20,30],[0,100,20,20,30]]);
    	        should.equal(sum, 5390);
    	    });
    it("97", function()
    	    {
    	       var sum = cal(2,1,1,4,"2000",[[0,100,40,32,20],[0,100,20,20,30],[0,100,20,20,30],[0,100,50,22,30],[0,100,20,20,30]]);
    	        should.equal(sum, 6430);
    	    });
    it("98", function()
    	    {
    	       var sum = cal(2,1,1,4,"2000",[[0,100,40,10,27]]);
    	        should.equal(sum, 0);
    	    });
    it("99", function()
    	    {
    	       var sum = cal(2,1,1,4,"2000",[[0,100,40,32,20],[0,100,20,20,30],[0,100,20,20,30],[0,100,20,20,30],[0,100,20,20,30],[0,100,20,20,30]]);
    	        should.equal(sum, 6980);
    	    });
    it("100", function()
    	    {
    	       var sum = cal(2,1,1,4,"2000",[[0,100,40,32,20],[0,100,20,20,30],[0,100,20,20,30],[0,100,40,32,30],[0,100,20,20,30],[0,100,20,20,30]]);
    	        should.equal(sum, 8020);
    	    });
    it("101", function()
    	    {
    	       var sum = cal(2,1,2,4,"2000",[[0,100,20,20,21]]);
    	        should.equal(sum, 0);
    	    });
    it("102", function()
    	    {
    	       var sum = cal(2,1,2,4,"2000",[[0,100,20,10,25],[0,100,20,20,21]]);
    	        should.equal(sum, 690);
    	    });
    it("103", function()
    	    {
    	       var sum = cal(2,1,2,4,"2000",[[0,100,20,10,29],[0,100,20,20,21]]);
    	        should.equal(sum, 1040);
    	    });
    it("104", function()
    	    {
    	       var sum = cal(2,1,2,4,"2000",[[0,100,20,10,29],[0,100,50,20,21]]);
    	        should.equal(sum, 2080);
    	    });
    it("105", function()
    	    {
    	       var sum = cal(2,1,2,4,"2000",[[0,100,50,20,29],[0,80,20,20,21]]);
    	        should.equal(sum, 2050);
    	    });
    it("106", function()
    	    {
    	       var sum = cal(2,1,2,4,"2000",[[0,90,20,10,21]]);
    	        should.equal(sum, 0);
    	    });
    it("107", function()
    	    {
    	       var sum = cal(2,1,2,4,"2000",[[0,100,20,10,25],[0,100,20,20,21],[0,90,20,10,24]]);
    	        should.equal(sum, 2760);
    	    });
    it("108", function()
    	    {
    	       var sum = cal(2,1,2,4,"2000",[[0,100,20,10,29],[0,100,20,20,21],[0,90,20,10,23]]);
    	        should.equal(sum, 2420);
    	    });
    it("109", function()
    	    {
    	       var sum = cal(2,1,2,4,"2000",[[0,100,40,30,20],[0,100,20,20,21],[0,100,40,30,23]]);
    	        should.equal(sum, 3460);
    	    });
    it("110", function()
    	    {
    	       var sum = cal(2,1,2,4,"2000",[[0,100,40,30,28],[0,100,20,20,21],[0,100,50,20,24]]);
    	        should.equal(sum, 5480);
    	    });
    it("111", function()
    	    {
    	       var sum = cal(2,1,2,4,"2000",[[0,80,20,20,21]]);
    	        should.equal(sum, 0);
    	    });
    it("112", function()
    	    {
    	       var sum = cal(2,1,2,4,"2000",[[0,80,20,20,24],[0,80,30,20,22],[0,80,50,20,20],[0,80,50,20,20]]);
    	        should.equal(sum, 3450);
    	    });
    it("113", function()
    	    {
    	       var sum = cal(2,1,2,4,"2000",[[0,80,20,20,29],[0,80,30,20,22],[0,80,50,20,20],[0,80,50,20,20]]);
    	        should.equal(sum, 3800);
    	    });
    it("114", function()
    	    {
    	       var sum = cal(2,1,2,4,"2000",[[0,100,40,30,21],[0,80,30,20,22],[0,80,50,20,20],[0,80,50,20,20]]);
    	        should.equal(sum, 3800);
    	    });
    it("115", function()
    	    {
    	       var sum = cal(2,1,2,4,"2000",[[0,100,40,30,29],[0,80,30,20,22],[0,80,50,20,20],[0,80,50,20,20]]);
    	        should.equal(sum, 4810);
    	    });
    it("116", function()
    	    {
    	       var sum = cal(2,1,2,4,"2000",[[0,80,20,20,20]]);
    	        should.equal(sum, 0);
    	    });
    it("117", function()
    	    {
    	       var sum = cal(2,1,2,4,"2000",[[0,80,20,20,24],[0,80,30,20,22],[0,80,50,20,20],[0,80,50,20,20],[0,50,30,20,30]]);
    	        should.equal(sum, 6080);
    	    });
    it("118", function()
    	    {
    	       var sum = cal(2,1,2,4,"2000",[[0,80,20,20,30],[0,80,30,20,22],[0,80,50,20,20],[0,80,50,20,20],[0,50,30,20,30]]);
    	        should.equal(sum, 6430);
    	    });
    it("119", function()
    	    {
    	       var sum = cal(2,1,2,4,"2000",[[0,100,40,40,20],[0,80,30,20,22],[0,80,50,20,20],[0,80,50,20,20],[0,50,30,20,20]]);
    	        should.equal(sum, 5390);
    	    });
    it("120", function()
    	    {
    	       var sum = cal(2,1,2,4,"2000",[[0,100,40,40,30],[0,80,30,20,22],[0,80,50,20,20],[0,80,50,20,20],[0,50,30,20,20]]);
    	        should.equal(sum, 6400);
    	    });
    it("121", function()
    	    {
    	       var sum = cal(1,1,2,4,"2000",[[0,60,20,20,10]]);
    	        should.equal(sum, 0);
    	    });
    it("122", function()
    	    {
    	       var sum = cal(2,1,2,4,"2000",[[0,80,20,20,24],[0,80,30,20,22],[0,80,50,20,20],[0,80,50,20,20],[0,50,30,20,30],[0,40,30,20,21]]);
    	        should.equal(sum, 7670);
    	    });
    it("123", function()
    	    {
    	       var sum = cal(2,1,2,4,"2000",[[0,80,20,20,30],[0,80,30,20,22],[0,80,50,20,20],[0,80,50,20,20],[0,50,30,20,30],[0,100,50,20,20]]);
    	        should.equal(sum,9060);
    	    });
    it("124", function()
    	    {
    	       var sum = cal(2,1,2,4,"2000",[[0,100,40,40,20],[0,80,30,20,22],[0,80,50,20,20],[0,80,50,20,20],[0,50,30,20,20],[0,50,30,20,25]]);
    	        should.equal(sum, 7670);
    	    });
    it("125", function()
    	    {
    	       var sum = cal(2,1,2,4,"2000",[[0,100,40,40,30],[0,80,30,20,22],[0,80,50,20,20],[0,80,50,20,20],[0,50,30,20,20],[0,50,30,20,18]]);
    	        should.equal(sum, 7990);
    	    });
    it("126", function()
    	    {
    	       var sum = cal(1,1,3,4,"3000",[[0,80,20,20,22]]);
    	        should.equal(sum, 0);
    	    });
    it("127", function()
    	    {
    	       var sum = cal(1,1,3,4,"3000",[[0,100,30,20,24]]);
    	        should.equal(sum, 690);
    	    });
    it("128", function()
    	    {
    	       var sum = cal(1,1,3,4,"3000",[[0,100,30,20,31]]);
    	        should.equal(sum,1040);
    	    });
    it("129", function()
    	    {
    	       var sum = cal(1,1,3,4,"3000",[[0,100,40,40,20]]);
    	        should.equal(sum, 1040);
    	    });
    it("130", function()
    	    {
    	       var sum = cal(1,1,3,4,"3000",[[0,100,50,40,24]]);
    	        should.equal(sum, 2050);
    	    });
    it("131", function()
    	    {
    	       var sum = cal(1,1,3,4,"3000",[[0,80,20,20,22]]);
    	        should.equal(sum, 0);
    	    });
    it("132", function()
    	    {
    	       var sum = cal(1,1,3,4,"3000",[[0,100,10,20,22],[0,100,30,20,24]]);
    	        should.equal(sum, 2070);
    	    });
    it("133", function()
    	    {
    	       var sum = cal(1,1,3,4,"3000",[[0,100,50,30,20],[0,100,30,20,23]]);
    	        should.equal(sum,2420);
    	    });
    it("134", function()
    	    {
    	       var sum = cal(1,1,3,4,"3000",[[0,100,30,20,31],[0,100,30,20,23]]);
    	        should.equal(sum, 2420);
    	    });
    it("135", function()
    	    {
    	       var sum = cal(1,1,3,4,"3000",[[0,100,50,40,24],[0,100,30,20,23]]);
    	        should.equal(sum, 3430);
    	    });
    it("136", function()
    	    {
    	       var sum = cal(1,1,3,4,"3000",[[0,80,20,20,22]]);
    	        should.equal(sum, 0);
    	    });
    it("137", function()
    	    {
    	       var sum = cal(1,1,3,4,"3000",[[0,100,10,20,22],[0,100,30,20,24],[0,100,30,20,23]]);
    	        should.equal(sum, 3450);
    	    });
    it("138", function()
    	    {
    	       var sum = cal(1,1,3,4,"3000",[[0,100,20,30,31],[0,100,30,20,23],[0,100,30,20,23]]);
    	        should.equal(sum,3800);
    	    });
    it("139", function()
    	    {
    	       var sum = cal(1,1,3,4,"3000",[[0,100,50,30,20],[0,100,30,20,23],[0,100,30,20,23]]);
    	        should.equal(sum, 3800);
    	    });
    it("140", function()
    	    {
    	       var sum = cal(1,1,3,4,"3000",[[0,100,50,40,31],[0,100,30,20,23],[0,100,30,20,23]]);
    	        should.equal(sum, 4810);
    	    });
    it("141", function()
    	    {
    	       var sum = cal(1,1,3,4,"3000",[[0,80,30,20,23]]);
    	        should.equal(sum, 0);
    	    });
    it("142", function()
    	    {
    	       var sum = cal(1,1,3,4,"3000",[[0,80,30,20,24],[0,100,30,20,23],[0,100,30,20,23],[0,100,30,20,23]]);
    	        should.equal(sum, 5040);
    	    });
    it("143", function()
    	    {
    	       var sum = cal(1,1,3,4,"3000",[[0,80,30,20,31],[0,100,30,20,23],[0,100,30,20,23],[0,100,30,20,23]]);
    	        should.equal(sum, 5390);
    	    });
    it("144", function()
    	    {
    	       var sum = cal(1,1,3,4,"3000",[[0,100,50,30,20],[0,100,30,20,23],[0,100,30,20,23],[0,100,30,20,23]]);
    	        should.equal(sum, 5390);
    	    });
    it("145", function()
    	    {
    	       var sum = cal(1,1,3,4,"3000",[[0,100,50,30,31],[0,100,30,20,23],[0,100,30,20,23],[0,100,30,20,23]]);
    	        should.equal(sum, 6400);
    	    });
   
    it("146", function()
    	    {
    	       var sum = cal(2,1,0,2,"1500",[[0,80,40,30,32]]);
    	        should.equal(sum, 0);
    	    });
    it("147", function()
    	    {
    	       var sum = cal(2,1,0,2,"1500",[[0,100,40,30,32]]);
    	        should.equal(sum, 690);
    	    });
    it("148", function()
    	    {
    	       var sum = cal(2,1,0,2,"1500",[[0,80,40,30,22],[0,80,40,30,22],[0,80,40,30,22]]);
    	        should.equal(sum, 1100);
    	    });
    it("149", function()
    	    {
    	       var sum = cal(2,1,0,2,"1500",[[0,80,50,30,22],[0,80,40,30,32],[0,80,40,30,22]]);
    	        should.equal(sum, 1790);
    	    });
    it("150", function()
    	    {
    	       var sum = cal(2,1,0,2,"2000",[[0,80,40,30,32],[0,70,40,30,27],[0,80,40,30,32],[0,70,40,30,27]]);
    	        should.equal(sum, 2200);
    	    });
    it("151", function()
    	    {
    	       var sum = cal(2,1,1,2,"2000",[[0,90,40,30,23],[0,40,40,30,32],[0,70,40,30,23],[0,90,40,30,32]]);
    	        should.equal(sum, 3580);
    	    });
    it("152", function()
    	    {
    	       var sum = cal(2,1,1,2,"2000",[[0,80,50,20,27]]);
    	        should.equal(sum, 0);
    	    });
    it("153", function()
    	    {
    	       var sum = cal(2,1,1,2,"2000",[[0,90,50,30,20],[0,80,40,20,30],[0,80,40,20,30],[0,80,40,20,30],[0,80,40,20,30]]);
    	        should.equal(sum, 4480);
    	    });
    it("154", function()
    	    {
    	       var sum = cal(2,1,1,2,"2000",[[0,90,50,30,20],[0,70,40,30,30],[0,70,40,30,30],[0,70,40,30,30],[0,100,40,20,30]]);
    	        should.equal(sum, 5170);
    	    });
    it("155", function()
    	    {
    	       var sum = cal(2,1,1,2,"2000",[[0,80,50,20,27]]);
    	        should.equal(sum, 0);
    	    });
    it("156", function()
    	    {
    	       var sum = cal(2,1,1,2,"2000",[[0,80,60,30,20],[0,70,40,30,30],[0,70,40,30,30],[0,70,40,30,30],[0,70,40,30,30],[0,70,40,30,30]]);
    	        should.equal(sum, 6070);
    	    });
    it("157", function()
    	    {
    	       var sum = cal(2,1,1,2,"2000",[[0,80,60,30,20],[0,70,40,30,32],[0,70,40,30,30],[0,70,40,30,30],[0,70,40,30,30],[0,70,50,40,30]]);
    	        should.equal(sum, 6760);
    	    });
    it("158", function()
    	    {
    	       var sum = cal(2,1,3,2,"2000",[[0,50,50,40,21]]);
    	        should.equal(sum, 0);
    	    });
    it("159", function()
    	    {
    	       var sum = cal(2,1,3,2,"2000",[[0,50,50,40,25],[0,50,50,40,21]]);
    	        should.equal(sum, 280);
    	    });
    it("160", function()
    	    {
    	       var sum = cal(2,1,3,2,"2000",[[0,50,50,40,29],[0,50,50,40,21]]);
    	        should.equal(sum, 690);
    	    });
    it("161", function()
    	    {
    	       var sum = cal(2,1,3,2,"2000",[[0,50,50,40,29],[0,100,30,40,21]]);
    	        should.equal(sum, 1380);
    	    });
    it("162", function()
    	    {
    	       var sum = cal(2,1,3,2,"2000",[[0,80,50,40,29],[0,50,50,20,21]]);
    	        should.equal(sum, 1100);
    	    });
    it("163", function()
    	    {
    	       var sum = cal(2,1,3,2,"2000",[[0,50,50,20,21]]);
    	        should.equal(sum, 0);
    	    });
    it("164", function()
    	    {
    	       var sum = cal(2,1,3,2,"2000",[[0,50,50,30,25],[0,50,50,40,21],[0,50,50,40,24]]);
    	        should.equal(sum, 1660);
    	    });
    it("165", function()
    	    {
    	       var sum = cal(2,1,3,2,"2000",[[0,50,50,30,29],[0,50,50,40,21],[0,50,40,40,23]]);
    	        should.equal(sum, 1790);
    	    });
    it("166", function()
    	    {
    	       var sum = cal(2,1,3,2,"2000",[[0,80,50,40,20],[0,50,50,40,21],[0,80,50,40,23]]);
    	        should.equal(sum, 2480);
    	    });
    it("167", function()
    	    {
    	       var sum = cal(1,1,3,2,"2000",[[0,80,50,40,28],[0,50,50,40,21],[0,80,50,40,24]]);
    	        should.equal(sum, 3300);
    	    });
    it("168", function()
    	    {
    	       var sum = cal(1,1,3,2,"2000",[[0,50,50,20,21]]);
    	        should.equal(sum, 0);
    	    });
    it("169", function()
    	    {
    	       var sum = cal(1,1,3,2,"2000",[[0,50,50,20,24],[0,50,50,30,22],[0,70,50,30,20],[0,70,50,30,20]]);
    	        should.equal(sum, 2480);
    	    });
    it("170", function()
    	    {
    	       var sum = cal(1,1,3,2,"2000",[[0,50,50,20,29],[0,50,50,30,22],[0,70,50,30,20],[0,70,50,30,20]]);
    	        should.equal(sum, 2890);
    	    });
    it("171", function()
    	    {
    	       var sum = cal(1,1,3,2,"2000",[[0,90,60,20,21],[0,50,50,30,22],[0,70,50,30,20],[0,70,50,30,20]]);
    	        should.equal(sum, 2890);
    	    });
    it("172", function()
    	    {
    	       var sum = cal(1,1,3,2,"2000",[[0,90,60,20,29],[0,50,50,30,22],[0,70,50,30,20],[0,70,50,30,20]]);
    	        should.equal(sum, 3300);
    	    });
    it("173", function()
    	    {
    	       var sum = cal(1,1,3,2,"2000",[[0,60,40,20,20]]);
    	        should.equal(sum, 0);
    	    });
    it("174", function()
    	    {
    	       var sum = cal(1,1,3,2,"2000",[[0,60,40,20,24],[0,50,50,30,22],[0,70,50,30,20],[0,70,50,30,20],[0,70,20,10,30]]);
    	        should.equal(sum, 4760);
    	    });
    it("175", function()
    	    {
    	       var sum = cal(1,1,3,2,"2000",[[0,60,20,20,30],[0,50,50,30,22],[0,70,50,30,20],[0,70,50,30,20],[0,70,20,10,30]]);
    	        should.equal(sum, 5170);
    	    });
    it("176", function()
    	    {
    	       var sum = cal(1,1,3,2,"2000",[[0,100,60,20,20],[0,50,50,30,22],[0,70,50,30,20],[0,70,50,30,20],[0,70,20,10,20]]);
    	        should.equal(sum, 4480);
    	    });
    it("177", function()
    	    {
    	       var sum = cal(1,1,3,2,"2000",[[0,100,60,20,30],[0,50,50,30,22],[0,70,50,30,20],[0,70,50,30,20],[0,70,20,10,20]]);
    	        should.equal(sum, 4890);
    	    });
    it("178", function()
    	    {
    	       var sum = cal(1,1,3,2,"2000",[[0,40,40,20,10]]);
    	        should.equal(sum, 0);
    	    });
    it("179", function()
    	    {
    	       var sum = cal(1,1,3,2,"2000",[[0,60,40,20,24],[0,50,50,30,22],[0,70,50,30,20],[0,70,50,30,20],[0,70,20,10,30],[0,70,20,10,21]]);
    	        should.equal(sum, 6350);
    	    });
    it("180", function()
    	    {
    	       var sum = cal(1,1,3,2,"2000",[[0,60,40,20,30],[0,50,50,30,22],[0,70,50,30,20],[0,70,50,30,20],[0,50,30,20,30],[0,90,50,30,20]]);
    	        should.equal(sum, 7450);
    	    });
    it("181", function()
    	    {
    	       var sum = cal(1,1,3,2,"2000",[[0,100,50,30,20],[0,50,50,30,22],[0,70,50,30,20],[0,70,50,30,20],[0,50,30,20,20],[0,50,30,20,25]]);
    	        should.equal(sum, 6350);
    	    });
    it("182", function()
    	    {
    	       var sum = cal(1,1,3,2,"2000",[[0,100,50,30,30],[0,50,50,30,22],[0,70,50,30,20],[0,70,50,30,20],[0,50,30,20,20],[0,50,30,20,20]]);
    	        should.equal(sum, 6480);
    	    });
});